package com.yx;

import org.junit.Test;

/**
 * @author yx
 * @date 2024-04-11 14:35
 * @description:
 */
public class IterationAndRecursion {

    @Test
    public void recursion() {
        int i = fib(8);
        System.out.println(i);
    }

    private int fib(int n) {
        if (n == 1 || n == 2) {
            return n - 1;
        }
        return fib(n - 1) + fib(n - 2);
    }

}
